﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;

namespace UBCon.Ribbon
{
    public partial class RibbonWindow
    {
        #region Commands

        private static RoutedUICommand closeCommand = new RoutedUICommand("Close", "CloseCommand", typeof(RibbonWindow));

        /// <summary>
        /// Gets the value that represents Close command.
        /// </summary>
        public static RoutedUICommand CloseCommand
        { 
            get 
            { 
                return closeCommand; 
            } 
        }

        private static RoutedUICommand minimizeCommand = new RoutedUICommand("Minimize", "MinimizeCommand", typeof(RibbonWindow));

        /// <summary>
        /// Gets the value that represents Minimize command.
        /// </summary>
        public static RoutedUICommand MinimizeCommand 
        {
            get 
            { 
                return minimizeCommand; 
            } 
        }

        private static RoutedUICommand maximizeCommand = new RoutedUICommand("Maximize", "MaximizeCommand", typeof(RibbonWindow));

        /// <summary>
        /// Gets the value that represents Maximize command.
        /// </summary>
        public static RoutedUICommand MaximizeCommand 
        {
            get 
            {
                return maximizeCommand; 
            } 
        }

        /// <summary>
        /// Occures when Close command is executed.
        /// </summary>
        /// <param name="sender">Owner of the event.</param>
        /// <param name="e">Event data for the event which provides data for System.Windows.Input.Executed
        /// and System.Windows.Input.PreviewExecuted routed events.</param>
        private void PerformClose(object sender, ExecutedRoutedEventArgs e) 
        {
            e.Handled = true;
            this.Close();
        }

        /// <summary>
        /// Occurs when Minimize command is executed.
        /// </summary>
        /// <param name="sender">Owner of the event.</param>
        /// <param name="e">Event data for the event which provides data for System.Windows.Input.Executed
        /// and System.Windows.Input.PreviewExecuted routed events.</param>
        private void PerformMinimize(object sender, ExecutedRoutedEventArgs e) 
        {
            e.Handled = true;
            
            if (this.WindowState != System.Windows.WindowState.Minimized)
                this.WindowState = System.Windows.WindowState.Minimized;
        }
        
        //private double pTop = 0.0, pLeft = 0.0, pWidth=0.0, pHeight=0;

        /// <summary>
        /// Occurs when Maximize command is executed.
        /// </summary>
        /// <param name="sender">Owner of the event.</param>
        /// <param name="e">Event data for the event which provides data for System.Windows.Input.Executed
        /// and System.Windows.Input.PreviewExecuted routed events.</param>
        private void PerformMaximize(object sender, ExecutedRoutedEventArgs e) 
        {
            e.Handled = true;

            this.WindowState = this.WindowState != System.Windows.WindowState.Maximized ? System.Windows.WindowState.Maximized : System.Windows.WindowState.Normal;

        }
      
        #endregion

    }
}
